<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Erste Zeile: Kurzbeschreibung für �bersichten.
 *
 * Mehrzeiliger, optionaler Dokumentationsblock.
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
function leftmenu($selectedPage, $selectetSubPage, $refPage)
{
	$info = array('info',
	 _('Info'),
	 'info',
	 _('Info'));
//------------------------------------------
	$page = array('page',
	 _('Pages'),
	 '|titel|',
	 _('Static-Menupages...'),
	 'startpage',
	 _('Startpage'),
	 'imprint',
	 _('Imprint'),
	 'terms',
	 _('Terms and conditions'),
	 'revocation',
	 _('Revocation Instruction'),
	 'about',
	 _('About us'),
	 'privacy',
	 _('Privacy Statement'),
	 '|titel|',
	 _('Orderpages...'),
	 'new_registration',
	 _('New Registration'),
	 'orderer.adress',
	 _('Orderer adress'),
	 'thanks',
	 _('Order completion'),
	 'sorry',
	 _('Sorry, no order completion'),
	'|titel|',
	 _('Email...'),
	 'email.footer',
	 _('Footer'),
	 'email.terms',
	 _('Email-Terms and conditions'),
	 'email.revocation',
	 _('Email-Revocation Instruction'));
//------------------------------------------
	$mail = array('mail',
	 _('Mail'),
	 'overview',
	 _('Overview'));
//------------------------------------------
	$article = array('article',
	 _('Article'),
	 'category',
	 _('Category'),
	 'article',
	 _('Article'),
	 'hr',
	 'line',
	 'pricelist',
	 _('Price lists'),
	 'attribute',
	 _('Attribute lists'),
	 'hr',
	 'line',
	 'calculator',
	 _('Calculator'));
//------------------------------------------
	$user = array('user',
	 _('User'),
	 'admin',
	 _('Admins'),
	 'customers',
	 _('Customers'));
//------------------------------------------
	$config = array('config',
	 _('Configuration'),
	 'plugin',
	 _('Plugin'),
	 'tax',
	 _('Tax'),
	 'shipping',
	 _('Shipping'),
	 'payment',
	 _('Payment'),
	 'hr',
	 'line',
	 'numbers',
	 _('Numbers'),
	  'hr',
	 'line',
	 'backup',
	 _('DB-Backup'),
	 'restore',
	 _('DB-Restore'));
//------------------------------------------
	$system = array('system',
	 _('System'),
	 'error',
	 _('Systemerrors'),
	 'global',
	 _('Global'),
	 'images',
	 _('Images'));
//------------------------------------------

	if (!in_array($selectetSubPage, $$selectedPage, TRUE) and $selectetSubPage <> '-')
	{
		header('location:/admin/index2.php?page=info&sub=info');
		exit;
	}

	$pageBuffer = '';
	$subMenu = $$selectedPage;
	if ($subMenu[2] === '|titel|')
	{
		$start = 4;
	}
	else
	{
		$start = 2;
	}
	
	// Create Leftmenu
	if ($selectetSubPage === '-')
	{
		$_GET['sub'] = $subMenu[$start];
		$selectetSubPage = $subMenu[$start];
	}

	for ($i = 2; $i <= (count($subMenu) - 1); $i += 2)
	{
		// Setting class for aktive Menueitem
		if ($selectetSubPage === $subMenu[$i])
		{
			$class = 'menuitem_green';
		}
		else
		{
			$class = 'menuitem';
		}

		if ($subMenu[$i] === 'hr')
		{
			$pageBuffer .= '<hr>';
		}
		else if ($subMenu[$i] === '|titel|')
		{
			$pageBuffer .= '<div class="submenutitel">' . $subMenu[$i + 1] . '</div>';
		}
		else
		{
			$pageBuffer .= '<a class="' . $class . '" href="index2.php?page=' . $selectedPage .
				'&sub=' . $subMenu[$i] . '">' . $subMenu[$i + 1] . '</a>';
		}
	}
	$refPage->assign('leftmenu', $pageBuffer);
}

?>